
<form name="editForm" role="form" novalidate ng-submit="vm.save()">

    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"
                ng-click="vm.clear()">&times;</button>
        <h4 class="modal-title" id="myQuestionnaireLabel" data-translate="milkbeeApp.questionnaire.home.createOrEditLabel">Create or edit a Questionnaire</h4>
    </div>
    <div class="modal-body">
        <jhi-alert-error></jhi-alert-error>
        <div class="form-group" ng-show="vm.questionnaire.id">
            <label for="id" data-translate="global.field.id">ID</label>
            <input type="text" class="form-control" id="id" name="id"
                    ng-model="vm.vote.questionnaire.id" readonly />
        </div>
        <div class="form-group">
            <label class="control-label" data-translate="milkbeeApp.questionnaire.title" for="field_title">Title</label>
            <input type="text" class="form-control" name="title" id="field_title"
                    ng-model="vm.vote.questionnaire.title"
                     />
        </div>

        <div class="form-group">
            <label class="control-label" data-translate="milkbeeApp.questionnaire.endAt" for="field_endAt">End At</label>
                <div class="input-group">
                    <input id="field_endAt" type="text" class="form-control" name="endAt" datetime-picker="{{dateformat}}" ng-model="vm.vote.questionnaire.endAt" button-bar="vm.buttonBar" datepicker-options="vm.datepickerOptions" is-open="vm.datePickerOpenStatus.endAt"
                      />
                    <span class="input-group-btn">
                        <button type="button" class="btn btn-default" ng-click="vm.openCalendar('endAt')"><i class="glyphicon glyphicon-calendar"></i></button>
                    </span>
                </div>
        </div>
        <div class="form-group">
            <label class="control-label" data-translate="milkbeeApp.questionnaire.detail" for="field_detail">Detail</label>
            <textarea type="text" class="form-control" name="detail" id="field_detail"
                    ng-model="vm.vote.questionnaire.detail"
                     />
        </div>
        <div class="form-group">
            <label class="control-label" data-translate="milkbeeApp.questionnaire.single" for="field_single">Single</label>
            <input type="number" class="form-control" name="single" id="field_single"
                    ng-model="vm.vote.questionnaire.single"
                     />
        </div>
        <div class="form-group">
            <label class="control-label" data-translate="milkbeeApp.questionnaire.categoryId" for="field_categoryId">Category Id</label>
            <input type="number" class="form-control" name="categoryId" id="field_categoryId" ng-show="false"
                    ng-model="vm.vote.questionnaire.categoryId"
                     />
           <select class="form-control" name="category" id="field_category" ng-options="item as item.name for item in vm.categories" ng-change="vm.categoryChange(vm.category.id)"
            	ng-model="vm.category" >
            </select>
        </div>
        <div  class="jumbotron" >
	        <div class="form-group " >
		            <label class="control-label" data-translate="milkbeeApp.candidate.home.title" for="field_title">Title</label>
	        </div>
			<div class="form-group " ng-repeat="candidate in vm.candidates">
	            <div class="input-group">
	            <input type="text" class="form-control" name="title" id="field_title" ng-model="candidate.content" />
	            	<span  class="input-group-btn">
	                  <button type="button" class="btn btn-info" ng-click="vm.addCandidate()"><i class="glyphicon glyphicon-plus"></i></button>
	             	</span>
	            </div>
	        </div>
        </div>
    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal" ng-click="vm.clear()">
            <span class="glyphicon glyphicon-ban-circle"></span>&nbsp;<span data-translate="entity.action.cancel">Cancel</span>
        </button>
        <button type="submit" ng-disabled="editForm.$invalid || vm.isSaving" class="btn btn-primary">
            <span class="glyphicon glyphicon-save"></span>&nbsp;<span data-translate="entity.action.save">Save</span>
        </button>
    </div>
</form>
